Release 10.1A: OpenEdge Development:
Progress Dynamics Advanced Development
Using the multiTranslation call and the translation temp-table
If you have a large number of strings that you want to translate in a single call, use the
multiTranslationAPI call, as shown:
The
multiTranslationcall takes two parameters:
INPUT plAllLanguages (LOGICAL)—TRUEif records should be returned for every language an input string has been translated into, otherwiseFALSE. IfTRUE, then extra records are created in the temp-table for each language available. The temp-table must, in that case, initially contain entries with a language object ID of 0. These are deleted in the temp-table that is returned, which, instead, contains a record for the translation into each language.INPUT-OUTPUT TABLE ttTranslate— ThettTranslatetemp-table is defined in the include fileaf/app/aftttranslate.i. This temp-table definition is used by the Localization Manager itself, and you can define a temp-table based on it as well as for calls such asmultiTranslation.These are the fields in the table:
These fields should be familiar to you if you have seen the parameter list for
getTranslation.
![]()
To use the
Translationtemp-table, first define it in the custom super procedure and then populate it:
- Include the definition in the Definitions section of
browsercustom.p, as shown:
- Populate the table in
createBrowsePopupMenuto pass it in tomultiTranslation. Define a variable with the text strings you need, and a counter variable to walk through them, as shown:
- Populate the temp-table with records for each of the strings needing translation, as shown:
- Pass this to the API call, as shown:
The same temp-table is returned with the
cTranslatedLabelfield filled with the translation. If the current language is the original language or if there is no translation for an item, then nothing is returned in thecTranslatedLabelfield. Therefore you must check for this and use the original text string in that case, as shown:
- Retrieve the appropriate temp-table record for each of the menu items and use the translation for the label. Note that they will not (likely) come back in the order in which you created them because there’s no sequence assigned (as in the example above), as shown:
- After you are done using the temp-table, empty it, as shown:
- Save and compile the modifications to
browsercustom.p, delete the current running instance of the super procedure in the Procedures ProTool, and return your test window. Now you see the translated strings, because you are logged in as a French user, as shown:
![]()
The Localization Manager itself uses
translatePhraseand the other API calls here to translate titles, labels, and substitution arguments in messages. If you define text translations for these types of strings in your application, they will be translated for you in all the standard places where the framework handles translations. You can use the same calls as you did here to translate other text that the framework does not take care of for you.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |